
var _path = '/zpmng/';
//url:form add and edit jsp
var _formAddEditUrl="/admin123/coding/owTask/wf_add_edit.jsp";
//url:form edit action
var _formEditAction="/admin123/coding/owTask/owTaskAjax_wfEditData.action";




//url:form add action
var _formAddAction="/admin123/coding/owTask/owTaskAjax_addData.action";
//url:form remove action
var _formRemoveAction="/admin123/coding/owTask/owTaskAjax_removeData.action";
//url:report
var _formReportAction="/admin123/coding/owTask/add_edit.jsp";





var _keyRandom='ow_task';
//上个页面通过右击列表 传过来的 id和row; ps:右击模板x列，看模板列列表，自动加载列数，要传模板id找表名
var _prePageListRow = '${paramValues.row[0]}';
_prePageListRow = decodeURI(_prePageListRow);
var _prePageListId = '${paramValues._id[0]}';

//template table foreign key
var _foreignKey = '';
var _primaryKey = 'id';

//add dialog width and height
var _width4AddDialog = '0';
var _height4AddDialog = '0';
if(_width4AddDialog == '' || _width4AddDialog == '0')_width4AddDialog=800;
if(_height4AddDialog == '' || _height4AddDialog == '0')_height4AddDialog=400;
//dialog style, 取代上面的方法
var _isdialog4AddDialog = '1';
var _style4AddDialog = 'width:800px;height:500px;';
if(_style4AddDialog == '')_style4AddDialog='width:800px;height:400px';


/*
	hidden fileds when option has changed
	选择optionId时，filedList是要隐藏的域
	结构如下 ：
	var hiddenFileds = [
		{"optionId":"11","filedList":[{"text":"foreignkey"},{"text":"tablenamesql"}]},
		{"optionId":"12","filedList":[{"text":"tablenamehistorysql"},{"text":"sqlsum"}]}
	];
*/
var hiddenFileds = []



/**
	页面datagrid控件显示列元素：datagrid.columns
*/
var datagrid_columns = [[
	{"field":"id","width":100,"title":"ID"},
	{"field":"registerDataNumber","width":100,"title":"登记编号"},
	{"field":"taskNumber","width":100,"title":"任务编号"},
	{"field":"deleteflag","width":100,"title":"deleteflag"},
	{"field":"createdate","width":100,"title":"创建日期"},
	{"field":"owPriorityCode","hidden":"true","title":"紧急程度"},
	{"field":"owPriorityCode_Str","width":100,"title":"紧急程度"},
	{"field":"createman","width":100,"title":"createman"},
	{"field":"owTaskType","hidden":"true","title":"任务类型"},
	{"field":"owTaskType_Str","width":100,"title":"任务类型"},
	{"field":"modifydate","width":100,"title":"modifydate"},
	{"field":"owRegisterType","hidden":"true","title":"登记类型"},
	{"field":"owRegisterType_Str","width":100,"title":"登记类型"},
	{"field":"modifyman","width":100,"title":"modifyman"},
	{"field":"owViolationType","hidden":"true","title":"违规类型"},
	{"field":"owViolationType_Str","width":100,"title":"违规类型"},
	{"field":"createmanId","width":100,"title":"createman_id"},
	{"field":"finderDeptId","width":100,"title":"统计部门Id"},
	{"field":"modifymanId","width":100,"title":"modifyman_id"},
	{"field":"finderDeptName","width":100,"title":"统计部门名称"},
	{"field":"companyId","width":100,"title":"company_id"},
	{"field":"baseCommiteeId","width":100,"title":"居委"},
	{"field":"baseRoadId","width":100,"title":"居委管理道路"},
	{"field":"posHouseNumber","width":100,"title":"门牌号"},
	{"field":"posDesc","width":100,"title":"位置详细"},
	{"field":"posLng","width":100,"title":"经度"},
	{"field":"posLat","width":100,"title":"纬度"},
	{"field":"litigantName","width":100,"title":"当事人"},
	{"field":"litigantPhone","width":100,"title":"当事人电话"},
	{"field":"mainManId","width":100,"title":"主办人员id"},
	{"field":"assistManId","width":100,"title":"协办人员id"},
	{"field":"mainManName","width":100,"title":"主办人姓名"},
	{"field":"issueContent","width":100,"title":"问题描述"},
	{"field":"assistManName","width":100,"title":"协办人姓名"},
	{"field":"remark","width":100,"title":"备注"},
	{"field":"improveRequied","width":100,"title":"整改要求"},
	{"field":"dealIssueContent","width":100,"title":"处理时现场情况"},
	{"field":"owDealType","hidden":"true","title":"处理方式"},
	{"field":"owDealType_Str","width":100,"title":"处理方式"},
	{"field":"dealTime","width":100,"title":"完成时间"},
	{"field":"dealResult","width":100,"title":"处理结果"},
	{"field":"dealRemark","width":100,"title":"解决备注"},
	{"formatter":function(value,rowData,rowIndex){if(typeof(rowData.id) == 'undefined'){return '';};var btn = '';btn += '<a linetail=\"edit\" class=\"editcls\" style=\"height:20px;\" onclick=\"editRow('+rowIndex+')\" href=\"javascript:void(0)\">编辑<\/a>';btn += '<a linetail=\"del\" class=\"delcls\" style=\"height:20px;\" onclick=\"removeRow('+rowIndex+')\" href=\"javascript:void(0)\">删除<\/a>'; return btn;},"field":"opt","width":160,"title":"操作","align":"center"}]]


/**
页面datagrid控件显示列元素：datagrid.frozenColumns
*/
var datagrid_frozenColumns = [[{"field":"name","width":100,"title":"标题"}]]

/**
页面datagrid控件显示列元素：datagrid.toolbarBtns
*/
var datagrid_toolbarBtns = [];
/*datagrid_toolbarBtns[datagrid_toolbarBtns.length] = {
 id:'toolbarAddBtnId',text:'添加',
 iconCls:'icon-add',
 handler:function(){toolbar_add();}
}*/



/**
datagrid ，后面在condition.js中init了
*/
var _queryUrl = "/springmvc/task/queryMyTaskListWF.mvc";
_queryUrl = _path + _queryUrl;
var datagrid={
	datagridId:"list",
	datagridUrl:_queryUrl,
	datagridObj:{
		/*title:"查询列表",*/
		nowrap:true,
		autoRowHeight:false,
		fit:true,
		columns:datagrid_columns,
		frozenColumns:datagrid_frozenColumns,
		toolbar:datagrid_toolbarBtns,
		rownumbers:true,
		showFooter:true,
		onRowContextMenu:onRowContextMenu
	}
};


var isFirstLoadSuccess = true;
datagrid.datagridObj.onLoadSuccess=function(){
	$('#'+datagrid.datagridId).datagrid('loaded');
	$("#queryBtn_Filter").removeAttr("disabled");
	$('.editcls').linkbutton({plain:true,iconCls:'icon-edit'});  //给每行后的button加easyui样式
	$('.delcls').linkbutton({plain:true,iconCls:'icon-remove'});
	//行尾button显示或隐藏
	$("[linetail='edit']").hide();
	authRequestUrl(_formEditAction,function(authResult){
		if(authResult){
			$("[linetail='edit']").show();
		}
	});
	$("[linetail='del']").hide();
	authRequestUrl(_formRemoveAction,function(authResult){
		if(authResult){
			$("[linetail='del']").show();
		}
	});

	//根据防问权限控制toolbar button显示或隐藏
	if (isFirstLoadSuccess) {
	$('#toolbarAddBtnId').hide();
	authRequestUrl(_formAddAction,function(authResult){
	 if(authResult){
	     $('#toolbarAddBtnId').show();
	  }
	});
	isFirstLoadSuccess = false;
	}

};



//添加右击菜单内容
var id;
var rowIndex;
function onRowContextMenu(e, rowIndex1, rowData){
	e.preventDefault();
	rowIndex = rowIndex1;
	var selected=$("#list").datagrid('getRows'); //获取所有行集合对象
	if(selected[rowIndex] == null){return;}
	id = selected[rowIndex].id; //index为当前右键行的索引，指向当前行对象
	$('#rightMenuDiv').menu('show', {
		left:e.pageX,
		top:e.pageY
	});
};




/**
打开AddDialog时，加载默认值
*/
var _defaultValueJOStr = {}


/**
所有列备份一下，一会隐藏了，可以恢复
*/
var _columnDivArray = new Array();
_columnDivArray[_columnDivArray.length] = '#_register_data_number_line';
_columnDivArray[_columnDivArray.length] = '#_task_number_line';
_columnDivArray[_columnDivArray.length] = '#_name_line';
_columnDivArray[_columnDivArray.length] = '#_ow_priority_code_line';
_columnDivArray[_columnDivArray.length] = '#_ow_task_type_line';
_columnDivArray[_columnDivArray.length] = '#_ow_register_type_line';
_columnDivArray[_columnDivArray.length] = '#_ow_violation_type_line';
_columnDivArray[_columnDivArray.length] = '#_finder_dept_id_line';
_columnDivArray[_columnDivArray.length] = '#_finder_dept_name_line';
_columnDivArray[_columnDivArray.length] = '#_base_commitee_id_line';
_columnDivArray[_columnDivArray.length] = '#_base_road_id_line';
_columnDivArray[_columnDivArray.length] = '#_pos_house_number_line';
_columnDivArray[_columnDivArray.length] = '#_pos_desc_line';
_columnDivArray[_columnDivArray.length] = '#_pos_lng_line';
_columnDivArray[_columnDivArray.length] = '#_pos_lat_line';
_columnDivArray[_columnDivArray.length] = '#_litigant_name_line';
_columnDivArray[_columnDivArray.length] = '#_litigant_phone_line';
_columnDivArray[_columnDivArray.length] = '#_main_man_id_line';
_columnDivArray[_columnDivArray.length] = '#_assist_man_id_line';
_columnDivArray[_columnDivArray.length] = '#_issue_content_line';
_columnDivArray[_columnDivArray.length] = '#_remark_line';
_columnDivArray[_columnDivArray.length] = '#_improve_requied_line';
_columnDivArray[_columnDivArray.length] = '#_deal_issue_content_line';
_columnDivArray[_columnDivArray.length] = '#_ow_deal_type_line';
_columnDivArray[_columnDivArray.length] = '#_deal_time_line';
_columnDivArray[_columnDivArray.length] = '#_deal_result_line';
_columnDivArray[_columnDivArray.length] = '#_deal_remark_line';


